<template>
    <div style="background-color: white">
        <div>
            <router-view></router-view>
        </div>
        <van-tabbar v-model="active">
            <van-tabbar-item icon="home-o">
                <router-link to="lawyerHome">首页</router-link>
            </van-tabbar-item>
            <van-tabbar-item icon="friends-o" :badge="count">
                <router-link to="lawyerChat">消息</router-link>
            </van-tabbar-item>
            <van-tabbar-item icon="setting-o">
                <router-link to="lawyerCenter">个人</router-link>
            </van-tabbar-item>
        </van-tabbar>
    </div>
</template>

<script>
    export default {
        name: "lawyerLayout",
        data() {
            return {
                active: 0,
                count:0,
            }

        },
        methods:{
            getMessageCount:function () {
                let user = JSON.parse(localStorage.getItem('token') || '{}');
                this.toUser = user
                this.$axios.post('/status/getChatCount?id='+this.toUser.id,
                    {}, res => {
                        this.count = res.data;
                        console.log(this.count);
                    })
            },
        },
        created:function () {
          this.getMessageCount();
        }
    }
</script>

<style scoped>

</style>
